package com.shou.zhnfyxt.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.shou.zhnfyxt.entity.Error;
import com.shou.zhnfyxt.entity.LoginUser;
import com.shou.zhnfyxt.entity.R;
import com.shou.zhnfyxt.entity.User;
import com.shou.zhnfyxt.mapper.UserMapper;
import com.shou.zhnfyxt.service.LoginServcie;
import com.shou.zhnfyxt.service.UserService;
import com.shou.zhnfyxt.utils.JwtUtil;
import com.shou.zhnfyxt.utils.RedisCache;
import io.jsonwebtoken.Claims;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.Objects;

@Controller
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @Autowired
    private UserMapper userMapper;

    @Autowired
    private RedisCache redisCache;

    @Autowired
    private LoginServcie loginServcie;


    @PostMapping("login")
    public R<Map<String, String>> userLogin(@RequestBody User user) {
        return loginServcie.login(user);
    }


}
